package com.atguigu.day16.work;

public class Work2 {
    static public int binarySearch(int[] intsArray,int des){
        int left=0;
        int right=intsArray.length-1;
        int mid =(left+right)/2;
        while (left<=right){
            if (intsArray[mid]==des){
                return mid;
            }else if(des>intsArray[mid]){
                left=mid+1;
            }else{
                right=mid-1;
            }
            mid =(left+right)/2;
        }
        return -1;
    }
}
